﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using XtremBiking.Web.Models.Rutinas;

namespace XtremBiking.Web.Controllers
{
    public class RoutineController : Controller
    {
        //
        // GET: /Routine/

        public ActionResult Index()
        {
            
            return View();
        }

        //
        // GET: /Routine/Details/5

        public ActionResult Details(int id)
        {
            return View();
        }

        //
        // GET: /Routine/Create

        public ActionResult Create()
        {
            CreateRoutine model = new CreateRoutine();
            return View(model);
        }

        //
        // POST: /Routine/Create

        [HttpPost]
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        //
        // GET: /Routine/Edit/5

        public ActionResult Edit(int id)
        {
            return View();
        }

        //
        // POST: /Routine/Edit/5

        [HttpPost]
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        //
        // GET: /Routine/Delete/5

        public ActionResult Delete(int id)
        {
            return View();
        }

        //
        // POST: /Routine/Delete/5

        [HttpPost]
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        public ActionResult AddSerie()
        {
            Serie model = new Serie();
            return View(model);
        }

        //
        // POST: /Routine/Delete/5

        [HttpPost]
        public ActionResult AddSerie(int id, Serie model, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
                var obj =" ";
                Session["Series"] = obj;
                return RedirectToAction("Index");

                if (Session["Series"] == null) 
                {
                    Session["Series"] = new List<Serie>();
                }
                //if (Session["Person"] != null)
                //{
                //    Person persona = (Person)Session["Person"];
                //    //persona.Emails
                //    foreach (Email item in persona.Emails)
                //    {
                //        if (item.Mail.Equals(mail))
                //        {
                //            validMail = false;
                //            break;
                //        }
                //    }
                //}



            }
            catch
            {
                return View();
            }
        }
    }
}
